﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace cmdb.keede.common
{
    public static class JsonSerializerExtenstions
    {
        /// <summary>
        /// 采用Newtonsoft.Json封装
        /// </summary>
        public static string ToJson(this object item)
        {
            return JsonConvert.SerializeObject(item);
        }

        /// <summary>
        /// 采用Newtonsoft.Json封装
        /// </summary>
        public static T FromJsonTo<T>(this string jsonString)
        {
            return JsonConvert.DeserializeObject<T>(jsonString);
        }
    }
}
